package com.dianqiu.common.service.impl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.dianqiu.base.service.impl.BaseService;
import com.dianqiu.common.bean.DqBetCompanyTO;
import com.dianqiu.common.bean.DqBetUserMatchTO;
import com.dianqiu.common.bean.DqClubsTO;
import com.dianqiu.common.bean.DqHandicapTO;
import com.dianqiu.common.bean.DqMatchPoolTO;
import com.dianqiu.common.bean.DqMatchTO;
import com.dianqiu.common.bean.DqUserBetConfigTO;
import com.dianqiu.common.service.BetService;

@Component("betService")
public class BetServiceImpl extends BaseService implements BetService {

	public List<DqMatchTO> getAllMatchGroupByMatchDate() {
		return this.getDqMatchDao().getAllMatchGroupByMatchDate();
	}

	public List<DqMatchPoolTO> getAllMatchPool() {
		return this.getDqMatchPoolDao().getAllMatchPool();
	}


	public List<DqMatchTO> getAllMatch() {
		return this.getDqMatchDao().getAllMatch();
	}


	public void saveDqBetUserMatchTO(DqBetUserMatchTO betUserMatch) {
		this.getDqBetUserMatchDao().saveDqBetUserMatchTO(betUserMatch);
	}

	public DqHandicapTO getHandicapByMatchId(Integer matchId) {
		return this.getDqHandicapDao().getHandicapByMatchId(matchId);
		 
	}

	public DqBetCompanyTO getPreferredBetCompanyByUserId(String userId) {
		DqUserBetConfigTO dqUserBetConfigTO = this.getDqUserBetConfigDao().getUserBetConfigByUserId(userId);
		if(dqUserBetConfigTO!=null){
			return dqUserBetConfigTO.getDqBetCompany();
		}
		return null;
	}

	public DqHandicapTO getHandicapByBetCompanyIdAndMatchId(Integer companyId, Integer matchId,String order) {
		return this.getDqHandicapDao().getHandicapByBetCompanyIdAndMatchId(companyId,matchId,order);
	}

	public List<DqMatchTO> getMatchByStatus(String matchStatus) {
		return this.getDqMatchDao().getMatchByStatus(matchStatus);
	}

	public List<DqMatchTO> getAllFinishedMatch(){
		return this.getDqMatchDao().getAllFinishedMatch();
	}

	public DqBetUserMatchTO getDqBetUserMatchByUserIdAndHandicapIdAndMatchId(
			String userId, Integer handicapId, Integer matchId) {
		return this.getDqBetUserMatchDao().getDqBetUserMatchByUserIdAndHandicapIdAndMatchId(userId, matchId, handicapId);
	}

	public List<DqClubsTO> getClubesById(Integer id) {
		return this.getDqClubsDao().getClubesById(id);
	}
	
	public DqHandicapTO getHandicapById(Integer id){
		return this.getDqHandicapDao().getHandicapById(id);
	}

	@Override
	public List<DqBetUserMatchTO> getDqBetUserMatchListByUserIdAndHandicapIdAndMatchId(
			String userId, Integer matchId, Integer handicapId) {
		// TODO Auto-generated method stub
		return this.getDqBetUserMatchDao().getDqBetUserMatchListByUserIdAndHandicapIdAndMatchId(userId, matchId, handicapId);
	}


}
